package cn.zcy.test;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;

import java.util.*;

public class Mytest {
    public static void main(String[] args) {
//        add();
//        add12();

        List<String> list =new ArrayList<>();
        list.add("sss");
        list.add("13245");

        String string = JSON.toJSONString(list);
        System.out.println("string = " + string);

List<Map<String,String>> list1=new LinkedList<>();
        Map<String, String> map=new LinkedHashMap<>();
        map.put("url","12345");
        map.put("name","dsfdsfs");
//        Map<String, String> map1=new HashMap<>();
//
//        map1.put("url","1234454875");

        list1.add(map);
//        list1.add(map1);
        String string1 = JSON.toJSONString(list1);
        System.out.println("string1 = " + string1);
    }

    private static void add12() {
        int l=1;
        int sum =getSum(4);
        System.out.println("sum = " + sum);
        if (l==1){
            System.out.println("sum = " + sum);
        }else {
            System.out.println("dddd");
        }
    }

    private static int getSum(int i) {
        if (i==1){
            return 1;
        }else {
            return i+getSum(i-1);
        }
    }

    private static void add() {
        int sum=0;
        for (int i = 0; i <= 100; i++) {
            sum=sum+i;
        }
        System.out.println("sum = " + sum);
    }
}
